﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdBrVertexLoopTraverser : OdBrTraverser
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdBrVertexLoopTraverser(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdBrVertexLoopTraverser_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdBrVertexLoopTraverser obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdBrVertexLoopTraverser()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdBrVertexLoopTraverser(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdBrVertexLoopTraverser() : this(GlobalsPINVOKE.new_OdBrVertexLoopTraverser(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdBrErrorStatus setVertex(OdBrVertex vertex)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrVertexLoopTraverser_setVertex(this.swigCPtr, OdBrVertex.getCPtr(vertex));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setLoop(OdBrLoop loop)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrVertexLoopTraverser_setLoop(this.swigCPtr, OdBrLoop.getCPtr(loop));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setVertexAndLoop(OdBrLoopVertexTraverser loopVertex)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrVertexLoopTraverser_setVertexAndLoop(this.swigCPtr, OdBrLoopVertexTraverser.getCPtr(loopVertex));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrLoop getLoop()
		{
			OdBrLoop result = new OdBrLoop(GlobalsPINVOKE.OdBrVertexLoopTraverser_getLoop(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrVertex getVertex()
		{
			OdBrVertex result = new OdBrVertex(GlobalsPINVOKE.OdBrVertexLoopTraverser_getVertex(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
